package com.godGuang.mine.service.impl;

import com.godGuang.common.core.domain.Result;
import com.godGuang.common.system.domain.SysUser;
import com.godGuang.mine.domain.*;
import com.godGuang.mine.domain.Req.ReqEvaluate;
import com.godGuang.mine.domain.Req.ReqTask;
import com.godGuang.mine.mapper.MineMapper;
import com.godGuang.mine.service.MineService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.UUID;
import java.util.regex.Pattern;

/**
 * @Author The future is full of hope
 * @CreateTime 2024/1/8 0008 14:05
 * @PackageName:com.godGuang.mine.service.impl
 * @ClassName: MineServiceImpl
 */

@Service
public class MineServiceImpl implements MineService {

    @Autowired
    private MineMapper mineMapper;
    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public List<Catalogue> queryCatalogueName() {
        return mineMapper.queryCatalogueName();
    }

    @Override
    public List<Disease> queryDiseaseNameByCatalogueId(Integer catalogueId) {
        return mineMapper.queryDiseaseNameByCatalogueId(catalogueId);
    }

    @Override
    public List<Drug> queryDrugNameByCatalogueId(Integer catalogueId) {
        return mineMapper.queryDrugNameByCatalogueId(catalogueId);
    }

    @Override
    public List<Pharmacy> queryPharmacyName() {
        return mineMapper.queryPharmacyName();
    }

    @Override
    public List<Drug> queryDrugByPharmacyId(Integer pharmacyId) {
        return mineMapper.queryDrugByPharmacyId(pharmacyId);
    }

    @Override
    public String attendance(ReqTask reqTask) {


        return null;
    }

    @Override
    public Drug queryMineByName(String name) {
        return mineMapper.queryMineByName(name);
    }

    @Override
    public void evaluateDoctor(ReqEvaluate reqEvaluate) {
        mineMapper.evaluateDoctor(reqEvaluate);
    }

    @Override
    public void insertDisease(Disease disease) {
        mineMapper.insertDisease(disease);
    }

    @Override
    public void insertGift(Gift gift) {
        Gift queryGiftByName =  mineMapper.queryGiftByName(gift.getDoctorName());
        if (null == queryGiftByName){
            mineMapper.insertGift(gift);
        }
        if (null != queryGiftByName){
            mineMapper.updateGift(gift);
        }
    }

    @Override
    public void insertEvaluate(Evaluate evaluate) {
        mineMapper.insertEvaluate(evaluate);
    }

}
